home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 4 / Mac Giga-ROM 4.0 - 1993.toast / FILES / BBS / FIRSTCLASS / INTERNET.LINK1.cpt / INTERNET.LINK1
Encoding:
Text File  |  1992-06-17  |  90.4 KB  |  1,546 lines  |  [TEXT/MACA]

  1. Item 0VRDS         Document ID Q588417
  2. TITLE: 920501 TCP/IP TUTORIAL:  INTRODUCTION TO THE INTERNET
  3.               PROTOCOLS (A PAPER WRITTEN AT RUTGERS UNIVERSITY)
  4.  
  5.  
  6. Q: The following document is an excellent explanation of the TCP/IP
  7.    protocols, written by Charles L. Hedrick at Rutgers University.
  8.    PLEASE NOTE that this document is copyrighted and you should comply
  9.    with the copyright and reproduction information stated on the title
  10.    page of this document.
  11.    =====================================
  12.  
  13.                                Introduction
  14.                                     to
  15.                           the Internet Protocols
  16.  
  17.                         C                       R
  18.  
  19.                                 C       S
  20.                     Computer Science Facilities Group
  21.                                 C       I
  22.  
  23.                         L                       S
  24.  
  25.                                  RUTGERS
  26.                     The State University of New Jersey
  27.  
  28.                                3 July 1987
  29.  
  30.   This is an introduction to the Internet networking protocols (TCP/IP).
  31.   It  includes  a  summary  of  the  facilities  available   and   brief
  32.   descriptions of the major protocols in the family.
  33.  
  34.   Copyright  (C)  1987,  Charles  L. Hedrick.  Anyone may reproduce this
  35.   document, in whole or in  part,  provided  that:    (1)  any  copy  or
  36.   republication  of  the entire document must show Rutgers University as
  37.   the source, and must include this notice; and (2)  any  other  use  of
  38.   this  material  must reference this manual and Rutgers University, and
  39.   the fact that the material is copyright by Charles Hedrick and is used
  40.   by permission.
  41.  
  42.   Unix is a trademark of AT&T Technologies, Inc.
  43.  
  44.                             Table of Contents
  45.  
  46.      1. What is TCP/IP?                                                1
  47.      2. General description of the TCP/IP protocols                    5
  48.          2.1 The TCP level                                             7
  49.          2.2 The IP level                                             10
  50.          2.3 The Ethernet level                                       11
  51.      3. Well-known sockets and the applications layer                 12
  52.          3.1 An example application: SMTP                             15
  53.      4. Protocols other than TCP: UDP and ICMP                        17
  54.      5. Keeping track of names and information: the domain system     18
  55.      6. Routing                                                       20
  56.  advice on
  57.   what to read for more information.  This  is  not  intended                                                                                                                                                                                                                                                                                                                                                                                  to  be  a
  58.   complete  description.    It  can  give  you  a reasonable idea of the
  59.   capabilities of the protocols.  But if you need to know any details of
  60.   the  technology,  you  will  want  to  read  the  standards  yourself.
  61.   Throughout the text, you will find references to the standards, in the
  62.   form of "RFC" or "IEN" numbers.  These are document numbers. The final
  63.   section of this  document  tells  you  how  to  get  copies  of  those
  64.   standards.
  65.  
  66.   1. What is TCP/IP?
  67.  
  68.   TCP/IP  is a set of protocols developed to allow cooperating computers
  69.   to share resources across a network.  It was developed by a  community
  70.   of  researchers centered around the ARPAnet.  Certainly the ARPAnet is
  71.   the best-known TCP/IP network.  However as of June, 87, at  least  130
  72.   different  vendors  had products that support TCP/IP, and thousands of
  73.   networks of all kinds use it.
  74.  
  75.   First some basic definitions.  The most accurate name for the  set  of
  76.   protocols we are describing is the "Internet protocol suite".  TCP and
  77.   IP are two of the protocols in this suite.  (They  will  be  described
  78.   below.)    Because  TCP and IP are the best known of the protocols, it
  79.   has become common to use the term TCP/IP or IP/TCP  to  refer  to  the
  80.   whole  family.  It is probably not worth fighting this habit.  However
  81.   this can lead to some oddities.  For example, I  find  myself  talking
  82.   about  NFS as being based on TCP/IP, even though it doesn't use TCP at
  83.   all.  (It does use IP.  But it  uses  an  alternative  protocol,  UDP,
  84.   instead  of TCP.  All of this alphabet soup will be unscrambled in the
  85.   following pages.)
  86.  
  87.   The Internet is a  collection  of  networks,  including  the  Arpanet,
  88.   NSFnet, regional networks such as NYsernet, local networks at a number
  89.   of University and research institutions,  and  a  number  of  military
  90.   networks.  The term "Internet" applies to this entire set of networks.
  91.   The subset of them that is managed by the  Department  of  Defense  is
  92.   referred  to  as the "DDN" (Defense Data Network).  This includes some
  93.   research-oriented networks, such as  the  Arpanet,  as  well  as  more
  94.   strictly  military  ones.    (Because much of the funding for Internet
  95.   protocol developments is done via  the  DDN  organization,  the  terms
  96.   Internet  and  DDN  can  sometimes  seem  equivalent.)    All of these
  97.   networks are connected to each other.  Users can  send  messages  from
  98.   any  of  them  to  any other, except where there are security or other
  99.   policy restrictions on access.    Officially  speaking,  the  Internet
  100.   protocol  documents  are  simply  standards  adopted  by  the Internet
  101.   community for its own use.  More recently, the Department  of  Defense
  102.   issued a MILSPEC definition of TCP/IP.  This was intended to be a more
  103.   formal definition, appropriate for use in  purchasing  specifications.
  104.   However  most  of  the  TCP/IP community continues to use the Internet
  105.   standards.  The MILSPEC version is intended to be consistent with it.
  106.  
  107.   Whatever it is called, TCP/IP is a family of protocols.  A few provide
  108.                                     1
  109.  
  110.   "low-level" functions needed for many applications.  These include IP,
  111.   TCP, and UDP.  (These will be described in a bit more  detail  later.)
  112.   Others are protocols for doing specific tasks, e.g. transferring files
  113.   between computers, sending mail, or finding out who is  logged  in  on
  114.   another   computer.      Initially  TCP/IP  was  used  mostly  between
  115.   minicomputers or mainframes.  These machines had their own disks,  and
  116.   generally  were self-contained.  Thus the most important "traditional"
  117.   TCP/IP services are:
  118.  
  119.      - file transfer.  The file transfer protocol (FTP) allows a user on
  120.        any computer to get files from another computer, or to send files
  121.        to another computer.  Security is handled by requiring  the  user
  122.        to  specify  a  user  name  and  password for the other computer.
  123.        Provisions are made for handling file transfer  between  machines
  124.        with different character set, end of line conventions, etc.  This
  125.        is not quite the same thing as more recent "network file  system"
  126.        or  "netbios"  protocols, which will be described below.  Rather,
  127.        FTP is a utility that you run any time you want to access a  file
  128.        on  another  system.    You  use  it to copy the file to your own
  129.        system.  You then work with the local copy.   (See  RFC  959  for
  130.        specifications for FTP.)
  131.  
  132.      - remote  login.    The network terminal protocol (TELNET) allows a
  133.        user to log in on any other computer on the network.  You start a
  134.        remote session by specifying a computer to connect to.  From that
  135.        time until you finish the session, anything you type is  sent  to
  136.        the  other  computer.   Note that you are really still talking to
  137.        your own computer.  But the telnet program effectively makes your
  138.        computer invisible while it is running.  Every character you type
  139.        is sent directly to the other system.  Generally, the  connection
  140.        to  the  remote  computer  behaves much like a dialup connection.
  141.        That is, the remote system will ask you to  log  in  and  give  a
  142.        password, in whatever manner it would normally ask a user who had
  143.        just dialed it up.  When you log off of the other  computer,  the
  144.        telnet  program exits, and you will find yourself talking to your
  145.        own computer.  Microcomputer implementations of telnet  generally
  146.        include  a  terminal  emulator  for some common type of terminal.
  147.        (See RFC's 854 and 855 for specifications for  telnet.    By  the
  148.        way,  the  telnet protocol should not be confused with Telenet, a
  149.        vendor of commercial network services.)
  150.  
  151.      - computer mail.  This allows you to  send  messages  to  users  on
  152.        other  computers.    Originally, people tended to use only one or
  153.        two specific computers.  They  would  maintain  "mail  files"  on
  154.        those machines.  The computer mail system is simply a way for you
  155.        to add a message to another user's mail file.    There  are  some
  156.        problems  with  this  in  an environment where microcomputers are
  157.        used.  The most serious is that a micro is  not  well  suited  to
  158.        receive  computer  mail.    When you send mail, the mail software
  159.        expects to be able  to  open  a  connection  to  the  addressee's
  160.        computer, in order to send the mail.  If this is a microcomputer,
  161.        it may be turned off, or it may be running an  application  other
  162.        than  the mail system.  For this reason, mail is normally handled
  163.        by a larger system, where it is practical to have a  mail  server
  164.        running all the time.  Microcomputer mail software then becomes a
  165.                                     2
  166.  
  167.        user interface that retrieves mail from the mail  server.    (See
  168.        RFC  821  and  822 for specifications for computer mail.  See RFC
  169.        937 for a protocol designed for microcomputers to use in  reading
  170.        mail from a mail server.)
  171.  
  172.   These  services  should  be  present  in any implementation of TCP/IP,
  173.   except that micro-oriented implementations may  not  support  computer
  174.   mail.  These traditional applications still play a very important role
  175.   in TCP/IP-based networks.  However more recently,  the  way  in  which
  176.   networks  are  used has been changing.  The older model of a number of
  177.   large, self-sufficient computers is beginning to  change.    Now  many
  178.   installations    have    several   kinds   of   computers,   including
  179.   microcomputers, workstations, minicomputers, and  mainframes.    These
  180.   computers  are  likely  to be configured to perform specialized tasks.
  181.   Although people are still likely to work with one  specific  computer,
  182.   that  computer  will  call on other systems on the net for specialized
  183.   services.  This has  led  to  the  "server/client"  model  of  network
  184.   services.    A server is a system that provides a specific service for
  185.   the rest of the network.  A client is another system  that  uses  that
  186.   service.    (Note  that the server and client need not be on different
  187.   computers.  They could be  different  programs  running  on  the  same
  188.   computer.)    Here  are  the  kinds  of servers typically present in a
  189.   modern computer setup.  Note that these computer services can  all  be
  190.   provided within the framework of TCP/IP.
  191.  
  192.      - network  file  systems.   This allows a system to access files on
  193.        another computer in a somewhat more  closely  integrated  fashion
  194.        than FTP.  A network file system provides the illusion that disks
  195.        or other devices from one system are directly connected to  other
  196.        systems.    There  is no need to use a special network utility to
  197.        access a file on another system.  Your computer simply thinks  it
  198.        has  some  extra disk drives.  These extra "virtual" drives refer
  199.        to the other system's disks.    This  capability  is  useful  for
  200.        several different purposes.  It lets you put large disks on a few
  201.        computers, but still give others access to the disk space.  Aside
  202.        from the obvious economic benefits, this allows people working on
  203.        several computers  to  share  common  files.    It  makes  system
  204.        maintenance  and  backup  easier, because you don't have to worry
  205.        about updating  and  backing  up  copies  on  lots  of  different
  206.        machines.    A  number  of  vendors  now  offer  high-performance
  207.        diskless computers.  These computers have no disk drives at  all.
  208.        They  are  entirely dependent upon disks attached to common "file
  209.        servers".   (See  RFC's  1001  and  1002  for  a  description  of
  210.        PC-oriented   NetBIOS   over   TCP.     In  the  workstation  and
  211.        minicomputer area, Sun's Network File System is more likely to be
  212.        used.    Protocol  specifications  for  it are available from Sun
  213.        Microsystems.)
  214.  
  215.      - remote printing.  This allows you to  access  printers  on  other
  216.        computers  as if they were directly attached to yours.  (The most
  217.        commonly used protocol is the remote  lineprinter  protocol  from
  218.        Berkeley  Unix.  Unfortunately, there is no protocol document for
  219.        this.  However the C code is easily obtained  from  Berkeley,  so
  220.        implementations are common.)
  221.  
  222.                                     3
  223.  
  224.      - remote  execution.   This allows you to request that a particular
  225.        program be run on a different computer.  This is useful when  you
  226.        can  do  most  of  your work on a small computer, but a few tasks
  227.        require the resources of a larger system.  There are a number  of
  228.        different  kinds  of remote execution.  Some operate on a command
  229.        by command basis.  That is, you request that a  specific  command
  230.        or  set  of commands should run on some specific computer.  (More
  231.        sophisticated versions will choose a system that  happens  to  be
  232.        free.)    However  there are also "remote procedure call" systems
  233.        that allow a program to  call  a  subroutine  that  will  run  on
  234.        another  computer.    (There  are  many  protocols  of this sort.
  235.        Berkeley Unix contains two servers to execute commands  remotely:
  236.        rsh  and  rexec.   The man pages describe the protocols that they
  237.        use.  The user-contributed software with Berkeley 4.3 contains  a
  238.        "distributed  shell"  that  will  distribute tasks among a set of
  239.        systems, depending upon load.  Remote procedure  call  mechanisms
  240.        have  been  a  topic  for research for a number of years, so many
  241.        organizations have implementations of such facilities.  The  most
  242.        widespread commercially-supported remote procedure call protocols
  243.        seem to be Xerox's Courier and Sun's RPC.  Protocol documents are
  244.        available  from  Xerox and Sun.  There is a public implementation
  245.        of Courier over TCP as part of the user-contributed software with
  246.        Berkeley  4.3.   An implementation of RPC was posted to Usenet by
  247.        Sun, and also appears as part of  the  user-contributed  software
  248.        with Berkeley 4.3.)
  249.  
  250.      - name  servers.    In  large  installations, there are a number of
  251.        different collections of names that have to  be  managed.    This
  252.        includes  users  and their passwords, names and network addresses
  253.        for computers, and accounts.  It becomes  very  tedious  to  keep
  254.        this data up to date on all of the computers.  Thus the databases
  255.        are kept on a small number of systems.  Other systems access  the
  256.        data over the network.  (RFC 822 and 823 describe the name server
  257.        protocol used to keep track of host names and Internet  addresses
  258.        on  the  Internet.    This  is  now a required part of any TCP/IP
  259.        implementation.  IEN 116 describes an older name server  protocol
  260.        that is used by a few terminal servers and other products to look
  261.        up host names.  Sun's  Yellow  Pages  system  is  designed  as  a
  262.        general  mechanism to handle user names, file sharing groups, and
  263.        other databases commonly used by Unix  systems.    It  is  widely
  264.        available  commercially.    Its  protocol definition is available
  265.        from Sun.)
  266.  
  267.      - terminal servers.  Many installations no longer connect terminals
  268.        directly  to  computers.    Instead they connect them to terminal
  269.        servers.  A terminal server is simply a small computer that  only
  270.        knows  how  to  run  telnet  (or some other protocol to do remote
  271.        login).  If your terminal is  connected  to  one  of  these,  you
  272.        simply  type the name of a computer, and you are connected to it.
  273.        Generally it is possible to have active connections to more  than
  274.        one  computer  at  the  same time.  The terminal server will have
  275.        provisions to switch between connections rapidly, and  to  notify
  276.        you  when  output  is  waiting for another connection.  (Terminal
  277.        servers use the telnet protocol, already mentioned.  However  any
  278.        real terminal server will also have to support name service and a
  279.                                     4
  280.  
  281.        number of other protocols.)
  282.  
  283.      - network-oriented  window  systems.      Until   recently,   high-
  284.        performance  graphics  programs had to execute on a computer that
  285.        had  a  bit-mapped  graphics  screen  directly  attached  to  it.
  286.        Network  window  systems  allow  a  program to use a display on a
  287.        different computer.  Full-scale network window systems provide an
  288.        interface  that  lets you distribute jobs to the systems that are
  289.        best  suited  to  handle  them,  but  still  give  you  a  single
  290.        graphically-based  user  interface.  (The most widely-implemented
  291.        window system is X. A  protocol  description  is  available  from
  292.        MIT's  Project  Athena.  A reference implementation is publically
  293.        available from MIT.  A number  of  vendors  are  also  supporting
  294.        NeWS,  a window system defined by Sun.  Both of these systems are
  295.        designed to use TCP/IP.)
  296.  
  297.   Note that some of the  protocols  described  above  were  designed  by
  298.   Berkeley,  Sun,  or other organizations.  Thus they are not officially
  299.   part of the Internet protocol suite.   However  they  are  implemented
  300.   using  TCP/IP, just as normal TCP/IP application protocols are.  Since
  301.   the protocol definitions are not  considered  proprietary,  and  since
  302.   commercially-support  implementations  are  widely  available,  it  is
  303.   reasonable to think of these protocols as being  effectively  part  of
  304.   the  Internet  suite.   Note that the list above is simply a sample of
  305.   the sort of services  available  through  TCP/IP.    However  it  does
  306.   contain   the  majority  of  the  "major"  applications.    The  other
  307.   commonly-used protocols tend to be specialized facilities for  getting
  308.   information  of  various  kinds, such as who is logged in, the time of
  309.   day, etc.  However if you need a facility that is not listed here,  we
  310.   encourage  you  to  look  through  the  current  edition  of  Internet
  311.   Protocols (currently RFC 1011),  which  lists  all  of  the  available
  312.   protocols,   and   also   to   look   at  some  of  the  major  TCP/IP
  313.   implementations to see what various vendors have added.
  314.  
  315.   2. General description of the TCP/IP protocols
  316.  
  317.   TCP/IP is a layered set of protocols.  In  order  to  understand  what
  318.   this  means,  it is useful to look at an example.  A typical situation
  319.   is sending mail.  First, there is a protocol for mail.  This defines a
  320.   set  of  commands which one machine sends to another, e.g. commands to
  321.   specify who the sender of the message is, who it is being sent to, and
  322.   then  the  text  of  the  message.  However this protocol assumes that
  323.   there is a way to communicate  reliably  between  the  two  computers.
  324.   Mail,  like  other  application  protocols,  simply  defines  a set of
  325.   commands and messages to be sent.  It is designed to be used  together
  326.   with  TCP and IP. TCP is responsible for making sure that the commands
  327.   get through to the other end.  It keeps track of  what  is  sent,  and
  328.   retransmitts anything that did not get through.  If any message is too
  329.   large for one datagram, e.g. the text of the mail, TCP will  split  it
  330.   up  into  several  datagrams,  and  make  sure  that  they  all arrive
  331.   correctly.  Since these functions are needed  for  many  applications,
  332.   they are put together into a separate protocol, rather than being part
  333.                                     5
  334.  
  335.   of the specifications for sending mail.   You  can  think  of  TCP  as
  336.   forming a library of routines that applications can use when they need
  337.   reliable network communications with another computer.  Similarly, TCP
  338.   calls  on the services of IP.  Although the services that TCP supplies
  339.   are needed by  many  applications,  there  are  still  some  kinds  of
  340.   applications  that  don't  need them.  However there are some services
  341.   that every application needs.  So these services are put together into
  342.   IP.    As  with TCP, you can think of IP as a library of routines that
  343.   TCP calls on, but which is also available to applications  that  don't
  344.   use  TCP.    This  strategy  of building several levels of protocol is
  345.   called "layering".  We think of  the  applications  programs  such  as
  346.   mail,  TCP, and IP, as being separate "layers", each of which calls on
  347.   the services of the layer below it.   Generally,  TCP/IP  applications
  348.   use 4 layers:
  349.  
  350.      - an application protocol such as mail
  351.  
  352.      - a  protocol  such  as  TCP  that  provides  services need by many
  353.        applications
  354.  
  355.      - IP, which provides the basic  service  of  getting  datagrams  to
  356.        their destination
  357.  
  358.      - the  protocols  needed to manage a specific physical medium, such
  359.        as Ethernet or a point to point line.
  360.  
  361.   TCP/IP is based on the "catenet model".  (This is  described  in  more
  362.   detail  in  IEN 48.)  This model assumes that there are a large number
  363.   of independent networks connected together  by  gateways.    The  user
  364.   should  be able to access computers or other resources on any of these
  365.   networks.   Datagrams  will  often  pass  through  a  dozen  different
  366.   networks  before  getting  to  their  final  destination.  The routing
  367.   needed to accomplish this should be completely invisible to the  user.
  368.   As  far  as  the  user  is concerned, all he needs to know in order to
  369.   access another system is an "Internet address".  This  is  an  address
  370.   that looks like 128.6.4.194.  It is actually a 32-bit number.  However
  371.   it is normally written as 4 decimal numbers, each representing 8  bits
  372.   of  the  address.  (The term "octet" is used by Internet documentation
  373.   for such 8-bit chunks.  The term "byte" is not used, because TCP/IP is
  374.   supported  by  some computers that have byte sizes other than 8 bits.)
  375.   Generally the structure of the  address  gives  you  some  information
  376.   about  how  to  get  to  the  system.  For example, 128.6 is a network
  377.   number assigned by a central authority to Rutgers University.  Rutgers
  378.   uses  the  next  octet  to  indicate  which of the campus Ethernets is
  379.   involved.  128.6.4 happens to be an  Ethernet  used  by  the  Computer
  380.   Science  Department.    The last octet allows for up to 254 systems on
  381.   each Ethernet.  (It is 254 because 0 and  255  are  not  allowed,  for
  382.   reasons  that  will  be  discussed  later.)  Note that 128.6.4.194 and
  383.   128.6.5.194 would be different systems.  The structure of an  Internet
  384.   address is described in a bit more detail later.
  385.  
  386.   Of  course  we  normally  refer  to  systems  by  name, rather than by
  387.   Internet address.  When we specify a name, the network software  looks
  388.   it  up  in  a  database,  and comes up with the corresponding Internet
  389.   address.  Most of the network software deals strictly in terms of  the
  390.                                     6
  391.  
  392.   address.  (RFC 882 describes the name server technology used to handle
  393.   this lookup.)
  394.  
  395.   TCP/IP is  built  on  "connectionless"  technology.    Information  is
  396.   transfered  as  a sequence of "datagrams".  A datagram is a collection
  397.   of data that is sent as a single message.  Each of these datagrams  is
  398.   sent  through  the network individually.  There are provisions to open
  399.   connections (i.e.  to start a conversation that will continue for some
  400.   time).    However at some level, information from those connections is
  401.   broken up into datagrams, and  those  datagrams  are  treated  by  the
  402.   network  as  completely  separate.    For example, suppose you want to
  403.   transfer a 15000 octet file.  Most networks can't handle a 15000 octet
  404.   datagram.   So the protocols will break this up into something like 30
  405.   500-octet datagrams.  Each of these datagrams  will  be  sent  to  the
  406.   other  end.    At  that point, they will be put back together into the
  407.   15000-octet file.  However while those datagrams are in  transit,  the
  408.   network doesn't know that there is any connection between them.  It is
  409.   perfectly possible  that  datagram  14  will  actually  arrive  before
  410.   datagram  13.    It is also possible that somewhere in the network, an
  411.   error will occur, and some datagram won't get through at all.  In that
  412.   case, that datagram has to be sent again.
  413.  
  414.   Note  by  the way that the terms "datagram" and "packet" often seem to
  415.   be nearly interchangable.  Technically, datagram is the right word  to
  416.   use  when  describing  TCP/IP.  A datagram is a unit of data, which is
  417.   what the protocols deal with.  A packet is a physical thing, appearing
  418.   on an Ethernet or some wire.  In most cases a packet simply contains a
  419.   datagram, so there is  very  little  difference.    However  they  can
  420.   differ.  When TCP/IP is used on top of X.25, the X.25 interface breaks
  421.   the datagrams up into 128-byte packets.   This  is  invisible  to  IP,
  422.   because  the  packets  are put back together into a single datagram at
  423.   the other end before being processed by TCP/IP.  So in this case,  one
  424.   IP  datagram  would  be carried by several packets.  However with most
  425.   media, there are efficiency advantages to  sending  one  datagram  per
  426.   packet, and so the distinction tends to vanish.
  427.  
  428.   2.1 The TCP level
  429.  
  430.   Two separate protocols are involved in handling TCP/IP datagrams.  TCP
  431.   (the "transmission control protocol") is responsible for  breaking  up
  432.   the  message  into  datagrams,  reassembling  them  at  the other end,
  433.   resending anything that gets lost, and  putting  things  back  in  the
  434.   right  order.  IP (the "internet protocol") is responsible for routing
  435.   individual datagrams.  It may seem like TCP is  doing  all  the  work.
  436.   And  in  small networks that is true.  However in the Internet, simply
  437.   getting a datagram to its  destination  can  be  a  complex  job.    A
  438.   connection  may require the datagram to go through several networks at
  439.   Rutgers, a serial line to the John von Neuman Supercomputer Center,  a
  440.   couple  of Ethernets there, a series of 56Kbaud phone lines to another
  441.   NSFnet site, and more Ethernets on another campus.  Keeping  track  of
  442.   the  routes  to all of the destinations and handling incompatibilities
  443.   among different transport media turns out to be a complex job.    Note
  444.                                     7
  445.  
  446.   that  the  interface  between TCP and IP is fairly simple.  TCP simply
  447.   hands IP a datagram with a destination.   IP  doesn't  know  how  this
  448.   datagram relates to any datagram before it or after it.
  449.  
  450.   It  may  have occurred to you that something is missing here.  We have
  451.   talked about Internet addresses, but not about how you keep  track  of
  452.   multiple  connections  to  a given system.  Clearly it isn't enough to
  453.   get a datagram to the right  destination.    TCP  has  to  know  which
  454.   connection  this  datagram  is  part  of.  This task is referred to as
  455.   "demultiplexing."  In fact, there are several levels of demultiplexing
  456.   going  on in TCP/IP.  The information needed to do this demultiplexing
  457.   is contained in a series of "headers".  A header is simply a few extra
  458.   octets  tacked  onto  the  beginning of a datagram by some protocol in
  459.   order to keep track of it.  It's a lot like putting a letter  into  an
  460.   envelope  and  putting  an  address  on  the  outside of the envelope.
  461.   Except with modern networks it happens several times.  It's  like  you
  462.   put the letter into a little envelope, your secretary puts that into a
  463.   somewhat bigger envelope, the campus mail center  puts  that  envelope
  464.   into a still bigger one, etc.  Here is an overview of the headers that
  465.   get stuck on a message that passes through a typical TCP/IP network:
  466.  
  467.   We start with a single data stream, say a file you are trying to  send
  468.   to some other computer:
  469.  
  470.      ......................................................
  471.  
  472.   TCP  breaks  it  up into manageable chunks.  (In order to do this, TCP
  473.   has to know how large a datagram your network can handle.    Actually,
  474.   the TCP's at each end say how big a datagram they can handle, and then
  475.   they pick the smallest size.)
  476.  
  477.      ....   ....   ....   ....   ....   ....   ....   ....
  478.  
  479.   TCP puts a header at the front of each datagram.  This header actually
  480.   contains  at least 20 octets, but the most important ones are a source
  481.   and destination "port number" and  a  "sequence  number".    The  port
  482.   numbers  are used to keep track of different conversations.  Suppose 3
  483.   different people are transferring files.  Your TCP might allocate port
  484.   numbers 1000, 1001, and 1002 to these transfers.  When you are sending
  485.   a datagram, this becomes the "source" port number, since you  are  the
  486.   source  of  the  datagram.    Of  course  the TCP at the other end has
  487.   assigned a port number of its own for the conversation.  Your TCP  has
  488.   to  know the port number used by the other end as well.  (It finds out
  489.   when the connection starts, as we will explain below.)  It  puts  this
  490.   in  the  "destination" port field.  Of course if the other end sends a
  491.   datagram back to you, the source and destination port numbers will  be
  492.   reversed,  since  then  it  will  be  the  source  and you will be the
  493.   destination.  Each datagram has a sequence number.  This  is  used  so
  494.   that  the  other  end  can make sure that it gets the datagrams in the
  495.   right  order,  and  that  it  hasn't  missed  any.    (See   the   TCP
  496.   specification for details.)  TCP doesn't number the datagrams, but the
  497.   octets.  So if there are 500 octets of  data  in  each  datagram,  the
  498.   first datagram might be numbered 0, the second 500, the next 1000, the
  499.   next 1500, etc.  Finally, I will mention the  Checksum.    This  is  a
  500.   number  that  is  computed by adding up all the octets in the datagram
  501.                                     8
  502.  
  503.   (more or less - see the TCP spec).  The result is put in  the  header.
  504.   TCP  at  the other end computes the checksum again.  If they disagree,
  505.   then something bad happened to the datagram in transmission, and it is
  506.   thrown away.  So here's what the datagram looks like now.
  507.  
  508.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  509.       ]          Source Port          ]       Destination Port        ]
  510.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  511.       ]                        Sequence Number                        ]
  512.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  513.       ]                    Acknowledgment Number                      ]
  514.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  515.       ]  Data ]           ]U]A]&)R]S]F]                               ]
  516.       ] Offset] Reserved  ]R]C]S]S]Y]I]            Window             ]
  517.       ]       ]           ]G].)H]T]+)+)                               ]
  518.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  519.       ]           Checksum            ]         Urgent Pointer        ]
  520.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  521.       ]   your data ... next 500 octets                               ]
  522.       ]   ......                                                      ]
  523.  
  524.   If  we abbreviate the TCP header as "T", the whole file now looks like
  525.   this:
  526.  
  527.      T....   T....   T....   T....   T....   T....   T....
  528.  
  529.   You will note that there are items in  the  header  that  I  have  not
  530.   described  above.    They  are  generally  involved  with managing the
  531.   connection.  In order to make sure the datagram  has  arrived  at  its
  532.   destination,  the  recipient  has  to  send back an "acknowledgement".
  533.   This is a datagram whose "Acknowledgement number" field is filled  in.
  534.   For  example,  sending  a  packet  with  an  acknowledgement  of  1500
  535.   indicates that you have received all the data up to octet number 1500.
  536.   If  the  sender  doesn't  get  an  acknowledgement within a reasonable
  537.   amount of time, it sends the data  again.    The  window  is  used  to
  538.   control  how  much  data can be in transit at any one time.  It is not
  539.   practical to wait for each datagram to be acknowledged before  sending
  540.   the  next  one.    That would slow things down too much.  On the other
  541.   hand, you can't just keep sending, or a fast  computer  might  overrun
  542.   the  capacity  of  a slow one to absorb data.  Thus each end indicates
  543.   how much new data it is currently prepared to absorb  by  putting  the
  544.   number  of  octets  in  its  "Window" field.  As the computer receives
  545.   data, the amount of space left in its window decreases.  When it  goes
  546.   to  zero, the sender has to stop.  As the receiver processes the data,
  547.   it increases its window, indicating that it is ready  to  accept  more
  548.   data.  Often the same datagram can be used to acknowledge receipt of a
  549.   set of data and to give permission for  additional  new  data  (by  an
  550.   updated  window).  The "Urgent" field allows one end to tell the other
  551.   to skip ahead in its processing to a particular octet.  This is  often
  552.   useful  for  handling asynchronous events, for example when you type a
  553.   control character or other command that interrupts output.  The  other
  554.   fields are beyond the scope of this document.
  555.  
  556.                                     9
  557.  
  558.   2.2 The IP level
  559.  
  560.   TCP  sends each of these datagrams to IP.  Of course it has to tell IP
  561.   the Internet address of the computer at the other end.  Note that this
  562.   is  all  IP  is concerned about.  It doesn't care about what is in the
  563.   datagram, or even in the TCP header.  IP's job is  simply  to  find  a
  564.   route for the datagram and get it to the other end.  In order to allow
  565.   gateways or other intermediate systems to  forward  the  datagram,  it
  566.   adds  its  own  header.  The main things in this header are the source
  567.   and destination Internet address (32-bit addresses, like 128.6.4.194),
  568.   the  protocol  number,  and  another  checksum.    The source Internet
  569.   address is simply the address of your machine.  (This is necessary  so
  570.   the  other  end  knows where the datagram came from.)  The destination
  571.   Internet address is the address  of  the  other  machine.    (This  is
  572.   necessary  so  any  gateways  in  the  middle  know where you want the
  573.   datagram to go.)  The protocol number tells IP at  the  other  end  to
  574.   send  the  datagram  to TCP.  Although most IP traffic uses TCP, there
  575.   are other protocols that can use IP, so you  have  to  tell  IP  which
  576.   protocol  to send the datagram to.  Finally, the checksum allows IP at
  577.   the other end to verify that the header  wasn't  damaged  in  transit.
  578.   Note  that TCP and IP have separate checksums.  IP needs to be able to
  579.   verify that the header didn't get damaged in transit, or it could send
  580.   a  message to the wrong place.  For reasons not worth discussing here,
  581.   it is both more efficient and safer to have  TCP  compute  a  separate
  582.   checksum  for  the  TCP  header  and  data.  Once IP has tacked on its
  583.   header, here's what the message looks like:
  584.  
  585.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  586.       ]Version]  IHL  ]Type of Service]          Total Length         ]
  587.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  588.       ]         Identification        ]Flags]      Fragment Offset    ]
  589.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  590.       ]  Time to Live ]    Protocol   ]         Header Checksum       ]
  591.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  592.       ]                       Source Address                          ]
  593.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  594.       ]                    Destination Address                        ]
  595.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  596.       ]  TCP header, then your data ......                            ]
  597.       ]                                                               ]
  598.  
  599.   If we represent the IP header by an "I",  your  file  now  looks  like
  600.   this:
  601.  
  602.      IT....   IT....   IT....   IT....   IT....   IT....   IT....
  603.  
  604.   Again,  the  header contains some additional fields that have not been
  605.   discussed.  Most of them are beyond the scope of this document.    The
  606.   flags  and fragment offset are used to keep track of the pieces when a
  607.   datagram has to be split up.   This  can  happen  when  datagrams  are
  608.   forwarded through a network for which they are too big.  (This will be
  609.   discussed a bit more below.)  The time to live is  a  number  that  is
  610.   decremented  whenever  the  datagram passes through a system.  When it
  611.   goes to zero, the datagram is discarded.  This is done in case a  loop
  612.                                     10
  613.  
  614.   develops  in the system somehow.  Of course this should be impossible,
  615.   but  well-designed  networks  are  built  to  cope  with  "impossible"
  616.   conditions.
  617.  
  618.   At this point, it's possible that no more headers are needed.  If your
  619.   computer happens to have a direct phone  line  connecting  it  to  the
  620.   destination  computer,  or  to  a  gateway,  it  may  simply  send the
  621.   datagrams out on the line (though likely a synchronous  protocol  such
  622.   as  HDLC  would be used, and it would add at least a few octets at the
  623.   beginning and end).
  624.  
  625.   2.3 The Ethernet level
  626.  
  627.   However most of our networks these days use Ethernet.  So now we  have
  628.   to  describe  Ethernet's headers.  Unfortunately, Ethernet has its own
  629.   addresses.  The people who designed Ethernet wanted to make sure  that
  630.   no  two  machines  would  end  up  with  the  same  Ethernet  address.
  631.   Furthermore, they  didn't  want  the  user  to  have  to  worry  about
  632.   assigning  addresses.    So  each  Ethernet  controller  comes with an
  633.   address builtin from the factory.  In order to  make  sure  that  they
  634.   would  never have to reuse addresses, the Ethernet designers allocated
  635.   48 bits for the Ethernet address.  People who make Ethernet  equipment
  636.   have  to  register  with  a  central  authority, to make sure that the
  637.   numbers they assign don't overlap any other manufacturer.  Ethernet is
  638.   a "broadcast medium".  That is, it is in effect like an old party line
  639.   telephone.  When you send a packet out on the Ethernet, every  machine
  640.   on  the  network sees the packet.  So something is needed to make sure
  641.   that the right machine gets it.  As you might guess, this involves the
  642.   Ethernet  header.    Every  Ethernet packet has a 14-octet header that
  643.   includes the source and destination Ethernet address, and a type code.
  644.   Each machine is supposed to pay attention only to packets with its own
  645.   Ethernet address in the destination field.  (It's  perfectly  possible
  646.   to  cheat,  which  is  one reason that Ethernet communications are not
  647.   terribly secure.)  Note  that  there  is  no  connection  between  the
  648.   Ethernet address and the Internet address.  Each machine has to have a
  649.   table of what Ethernet address corresponds to what  Internet  address.
  650.   (We  will  describe  how  this  table is constructed a bit later.)  In
  651.   addition to the addresses, the header contains a type code.  The  type
  652.   code is to allow for several different protocol families to be used on
  653.   the same network.  So you can use TCP/IP, DECnet, Xerox  NS,  etc.  at
  654.   the  same  time.   Each of them will put a different value in the type
  655.   field.  Finally,  there  is  a  checksum.    The  Ethernet  controller
  656.   computes a checksum of the entire packet.  When the other end receives
  657.   the packet, it recomputes the checksum, and throws the packet away  if
  658.   the  answer  disagrees  with the original.  The checksum is put on the
  659.   end of the packet, not in the header.  The final result is  that  your
  660.   message looks like this:
  661.  
  662.                                     11
  663.  
  664.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  665.       ]       Ethernet destination address (first 32 bits)            ]
  666.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  667.       ] Ethernet dest (last 16 bits)  ]Ethernet source (first 16 bits)]
  668.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  669.       ]       Ethernet source address (last 32 bits)                  ]
  670.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  671.       ]        Type code              ]
  672.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  673.       ]  IP header, then TCP header, then your data                   ]
  674.       ]                                                               ]
  675.           ...
  676.       ]                                                               ]
  677.       ]   end of your data                                            ]
  678.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  679.       ]                       Ethernet Checksum                       ]
  680.       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  681.  
  682.   If  we  represent  the  Ethernet  header  with  "E",  and the Ethernet
  683.   checksum with "C", your file now looks like this:
  684.  
  685.      EIT....C   EIT....C   EIT....C   EIT....C   EIT....C
  686.  
  687.   When these packets are received by the other end, of  course  all  the
  688.   headers  are  removed.    The  Ethernet interface removes the Ethernet
  689.   header and the checksum.  It looks at the type code.  Since  the  type
  690.   code  is the one assigned to IP, the Ethernet device driver passes the
  691.   datagram up to IP.  IP removes the IP header.   It  looks  at  the  IP
  692.   protocol  field.    Since  the  protocol  type  is  TCP, it passes the
  693.   datagram up to TCP.  TCP now looks at the sequence number.    It  uses
  694.   the  sequence  numbers  and  other  information  to  combine  all  the
  695.   datagrams into the original file.
  696.  
  697.   The ends our initial summary of TCP/IP.  There are still some  crucial
  698.   concepts we haven't gotten to, so we'll now go back and add details in
  699.   several areas.  (For detailed descriptions of the items discussed here
  700.   see,  RFC  793  for  TCP,  RFC  791  for IP, and RFC's 894 and 826 for
  701.   sending IP over Ethernet.)
  702.  
  703.   3. Well-known sockets and the applications layer
  704.  
  705.   So far, we have described how a stream  of  data  is  broken  up  into
  706.   datagrams,  sent  to another computer, and put back together.  However
  707.   something more is needed  in  order  to  accomplish  anything  useful.
  708.   There  has  to  be  a  way for you to open a connection to a specified
  709.   computer, log into it, tell it what file you  want,  and  control  the
  710.   transmission  of  the  file.   (If you have a different application in
  711.   mind, e.g. computer mail, some analogous protocol is needed.)  This is
  712.   done  by  "application  protocols".  The application protocols run "on
  713.   top" of TCP/IP.  That is, when they want to send a message, they  give
  714.   the  message  to  TCP.   TCP makes sure it gets delivered to the other
  715.   end.  Because TCP and IP take care of all the networking details,  the
  716.                                     12
  717.  
  718.   applications  protocols can treat a network connection as if it were a
  719.   simple byte stream, like a terminal or phone line.
  720.  
  721.   Before going into more details about applications programs, we have to
  722.   describe how you find an application.  Suppose you want to send a file
  723.   to a computer whose Internet address  is  128.6.4.7.    To  start  the
  724.   process,  you  need  more than just the Internet address.  You have to
  725.   connect to the FTP server at the  other  end.    In  general,  network
  726.   programs  are  specialized  for a specific set of tasks.  Most systems
  727.   have separate programs  to  handle  file  transfers,  remote  terminal
  728.   logins, mail, etc.  When you connect to 128.6.4.7, you have to specify
  729.   that you want to talk to the FTP server.    This  is  done  by  having
  730.   "well-known  sockets"  for  each  server.    Recall that TCP uses port
  731.   numbers to keep track of  individual  conversations.    User  programs
  732.   normally  use more or less random port numbers.  However specific port
  733.   numbers are assigned to the programs that sit  waiting  for  requests.
  734.   For  example,  if  you  want  to send a file, you will start a program
  735.   called "ftp".  It will open a connection using some random number, say
  736.   1234,  for  the  port number on its end.  However it will specify port
  737.   number 21 for the other end.  This is the official port number for the
  738.   FTP server.  Note that there are two different programs involved.  You
  739.   run ftp on your side.  This is a program designed to  accept  commands
  740.   from  your  terminal  and  pass them on to the other end.  The program
  741.   that you talk to on the other machine  is  the  FTP  server.    It  is
  742.   designed  to  accept commands from the network connection, rather than
  743.   an interactive terminal.  There is no need for your program to  use  a
  744.   well-known  socket  number  for  itself.  Nobody is trying to find it.
  745.   However the servers have to have well-known numbers,  so  that  people
  746.   can  open  connections  to  them and start sending them commands.  The
  747.   official  port  numbers  for  each  program  are  given  in  "Assigned
  748.   Numbers".
  749.  
  750.   Note  that  a  connection is actually described by a set of 4 numbers:
  751.   the Internet address at each end, and the TCP port number at each end.
  752.   Every  datagram  has  all  four of those numbers in it.  (The Internet
  753.   addresses are in the IP header, and the TCP port numbers  are  in  the
  754.   TCP header.)  In order to keep things straight, no two connections can
  755.   have the same set of numbers.  However it is enough for any one number
  756.   to  be  different.    For  example,  it  is perfectly possible for two
  757.   different users on a machine to be sending files  to  the  same  other
  758.   machine.    This  could  result  in  connections  with  the  following
  759.   parameters:
  760.  
  761.                      Internet addresses         TCP ports
  762.       connection 1  128.6.4.194, 128.6.4.7      1234, 21
  763.       connection 2  128.6.4.194, 128.6.4.7      1235, 21
  764.  
  765.   Since the same machines are involved, the Internet addresses  are  the
  766.   same.    Since  they  are  both  doing  file transfers, one end of the
  767.   connection involves the well-known port number  for  FTP.    The  only
  768.   thing  that  differs is the port number for the program that the users
  769.   are running.  That's enough of a difference.  Generally, at least  one
  770.   end  of  the  connection asks the network software to assign it a port
  771.   number that is guaranteed to be unique.   Normally,  it's  the  user's
  772.   end, since the server has to use a well-known number.
  773.                                     13
  774.  
  775.   Now  that  we  know  how  to  open  connections, let's get back to the
  776.   applications programs.  As mentioned earlier, once TCP  has  opened  a
  777.   connection,  we  have  something  that might as well be a simple wire.
  778.   All the hard parts are handled by TCP and IP.  However we  still  need
  779.   some  agreement  as  to  what we send over this connection.  In effect
  780.   this is simply an agreement on what set of  commands  the  application
  781.   will  understand,  and  the  format  in  which  they  are  to be sent.
  782.   Generally, what is sent is a combination of commands and data.    They
  783.   use  context  to  differentiate.  For example, the mail protocol works
  784.   like this: Your mail program opens a connection to the mail server  at
  785.   the  other end.  Your program gives it your machine's name, the sender
  786.   of the message, and the recipients you want it sent to.  It then sends
  787.   a  command saying that it is starting the message.  At that point, the
  788.   other end  stops  treating  what  it  sees  as  commands,  and  starts
  789.   accepting  the  message.  Your end then starts sending the text of the
  790.   message.  At the end of the message, a special mark is sent (a dot  in
  791.   the first column).  After that, both ends understand that your program
  792.   is again sending commands.  This is the simplest way to do things, and
  793.   the one that most applications use.
  794.  
  795.   File  transfer  is  somewhat more complex.  The file transfer protocol
  796.   involves two different connections.  It starts  out  just  like  mail.
  797.   The user's program sends commands like "log me in as this user", "here
  798.   is my password", "send me the file with this name".  However once  the
  799.   command  to  send  data is sent, a second connection is opened for the
  800.   data itself.  It would certainly be possible to send the data  on  the
  801.   same  connection,  as  mail does.  However file transfers often take a
  802.   long time.  The designers of the  file  transfer  protocol  wanted  to
  803.   allow  the  user  to  continue  issuing commands while the transfer is
  804.   going on.  For example, the user might make an inquiry,  or  he  might
  805.   abort  the  transfer.    Thus  the designers felt it was best to use a
  806.   separate connection for  the  data  and  leave  the  original  command
  807.   connection  for  commands.    (It  is  also  possible  to open command
  808.   connections to two different computers, and tell them to send  a  file
  809.   from  one  to  the other.  In that case, the data couldn't go over the
  810.   command connection.)
  811.  
  812.   Remote terminal connections use another mechanism still.   For  remote
  813.   logins,  there  is just one connection.  It normally sends data.  When
  814.   it is necessary to send a command (e.g. to set the terminal type or to
  815.   change  some  mode),  a special character is used to indicate that the
  816.   next character is a command.  If the user happens to type that special
  817.   character as data, two of them are sent.
  818.  
  819.   We  are  not  going to describe the application protocols in detail in
  820.   this document.  It's better to read the RFC's yourself.  However there
  821.   are  a  couple of common conventions used by applications that will be
  822.   described here.  First, the common network representation:  TCP/IP  is
  823.   intended  to  be  usable  on  any  computer.    Unfortunately, not all
  824.   computers agree on how data is represented.  There are differences  in
  825.   character  codes  (ASCII  vs.  EBCDIC),  in  end  of  line conventions
  826.   (carriage return, line feed, or a representation using counts), and in
  827.   whether  terminals expect characters to be sent individually or a line
  828.   at a time.   In  order  to  allow  computers  of  different  kinds  to
  829.   communicate,   each   applications   protocol   defines   a   standard
  830.                                     14
  831.  
  832.   representation.    Note  that  TCP  and  IP  do  not  care  about  the
  833.   representation.    TCP  simply  sends octets.  However the programs at
  834.   both ends have to agree on how the octets are to be interpreted.   The
  835.   RFC  for  each  application  specifies the standard representation for
  836.   that application.  Normally it  is  "net  ASCII".    This  uses  ASCII
  837.   characters,  with end of line denoted by a carriage return followed by
  838.   a line feed.  For remote login,  there  is  also  a  definition  of  a
  839.   "standard terminal", which turns out to be a half-duplex terminal with
  840.   echoing happening on the local machine.  Most applications  also  make
  841.   provisions  for  the  two  computers to agree on other representations
  842.   that they may find more convenient.  For example, PDP-10's have 36-bit
  843.   words.    There  is a way that two PDP-10's can agree to send a 36-bit
  844.   binary file.  Similarly, two systems that prefer full-duplex  terminal
  845.   conversations  can  agree  on  that.    However each application has a
  846.   standard representation, which every machine must support.
  847.  
  848.   3.1 An example application: SMTP
  849.  
  850.   In order to give a bit better idea what is involved in the application
  851.   protocols,  I'm  going  to  show an example of SMTP, which is the mail
  852.   protocol.  (SMTP is "simple mail transfer protocol.)  We assume that a
  853.   computer called TOPAZ.RUTGERS.EDU wants to send the following message.
  854.  
  855.     Date: Sat, 27 Jun 87 13:26:31 EDT
  856.     From: hedrick topaz.rutgers.edu
  857.     To: levy red.rutgers.edu
  858.     Subject: meeting
  859.  
  860.     Let's get together Monday at 1pm.
  861.  
  862.   First,  note  that the format of the message itself is described by an
  863.   Internet standard (RFC 822).  The standard specifies the fact that the
  864.   message  must be transmitted as net ASCII (i.e. it must be ASCII, with
  865.   carriage return/linefeed to delimit lines).   It  also  describes  the
  866.   general  structure, as a group of header lines, then a blank line, and
  867.   then the body of the message.  Finally, it describes the syntax of the
  868.   header  lines in detail.  Generally they consist of a keyword and then
  869.   a value.
  870.  
  871.   Note  that  the  addressee  is  indicated   as   LEVY RED.RUTGERS.EDU.
  872.   Initially,  addresses were simply "person at machine".  However recent
  873.   standards have made things more flexible.  There  are  now  provisions
  874.   for  systems  to handle other systems' mail.  This can allow automatic
  875.   forwarding on behalf of computers not connected to the Internet.    It
  876.   can be used to direct mail for a number of systems to one central mail
  877.   server.  Indeed there is no requirement that an actual computer by the
  878.   name  of RED.RUTGERS.EDU even exist.  The name servers could be set up
  879.   so that you mail to department names, and each  department's  mail  is
  880.   routed  automatically to an appropriate computer.  It is also possible
  881.   that the part before the   is something other than a user name.  It is
  882.   possible  for  programs  to be set up to process mail.  There are also
  883.   provisions  to  handle  mailing  lists,  and  generic  names  such  as
  884.                                     15
  885.  
  886.   "postmaster" or "operator".
  887.  
  888.   The  way  the  message is to be sent to another system is described by
  889.   RFC's 821 and 974.  The program that is going to be doing the  sending
  890.   asks  the  name server several queries to determine where to route the
  891.   message.  The first query is to find out which  machines  handle  mail
  892.   for  the  name RED.RUTGERS.EDU.  In this case, the server replies that
  893.   RED.RUTGERS.EDU handles its own mail.  The program then asks  for  the
  894.   address of RED.RUTGERS.EDU, which is 128.6.4.2.  Then the mail program
  895.   opens a TCP connection to port 25  on  128.6.4.2.    Port  25  is  the
  896.   well-known  socket  used  for receiving mail.  Once this connection is
  897.   established, the mail program starts sending  commands.    Here  is  a
  898.   typical  conversation.  Each line is labelled as to whether it is from
  899.   TOPAZ or RED.  Note that TOPAZ initiated the connection:
  900.  
  901.       RED    220 RED.RUTGERS.EDU SMTP Service at 29 Jun 87 05:17:18 EDT
  902.       TOPAZ  HELO topaz.rutgers.edu
  903.       RED    250 RED.RUTGERS.EDU - Hello, TOPAZ.RUTGERS.EDU
  904.       TOPAZ  MAIL From:<hedrick topaz.rutgers.edu>
  905.       RED    250 MAIL accepted
  906.       TOPAZ  RCPT To:<levy red.rutgers.edu>
  907.       RED    250 Recipient accepted
  908.       TOPAZ  DATA
  909.       RED    354 Start mail input; end with <CRLF>.<CRLF>
  910.       TOPAZ  Date: Sat, 27 Jun 87 13:26:31 EDT
  911.       TOPAZ  From: hedrick topaz.rutgers.edu
  912.       TOPAZ  To: levy red.rutgers.edu
  913.       TOPAZ  Subject: meeting
  914.       TOPAZ
  915.       TOPAZ  Let's get together Monday at 1pm.
  916.       TOPAZ  .
  917.       RED    250 OK
  918.       TOPAZ  QUIT
  919.       RED    221 RED.RUTGERS.EDU Service closing transmission channel
  920.  
  921.   First, note that commands all use normal text.  This is typical of the
  922.   Internet  standards.    Many  of  the  protocols  use  standard  ASCII
  923.   commands.  This makes it easy  to  watch  what  is  going  on  and  to
  924.   diagnose  problems.  For example, the mail program keeps a log of each
  925.   conversation.  If something goes wrong, the log  file  can  simply  be
  926.   mailed  to  the  postmaster.  Since it is normal text, he can see what
  927.   was going on.  It also allows a human to interact  directly  with  the
  928.   mail  server,  for  testing.  (Some newer protocols are complex enough
  929.   that this is not practical.  The commands would have to have a  syntax
  930.   that would require a significant parser.  Thus there is a tendency for
  931.   newer protocols to use binary formats.  Generally they are  structured
  932.   like  C or Pascal record structures.)  Second, note that the responses
  933.   all begin with numbers.  This is also typical of  Internet  protocols.
  934.   The  allowable  responses  are  defined  in the protocol.  The numbers
  935.   allow the user program to respond unambiguously.    The  rest  of  the
  936.   response  is  text,  which is normally for use by any human who may be
  937.   watching or looking at a log.  It has no effect on  the  operation  of
  938.   the  programs.  (However there is one point at which the protocol uses
  939.   part of the text of the response.)   The  commands  themselves  simply
  940.   allow  the  mail  program  on  one  end  to  tell  the mail server the
  941.                                     16
  942.  
  943.   information it needs to know in order to deliver the message.  In this
  944.   case,  the  mail  server  could  get the information by looking at the
  945.   message itself.  But for more complex cases, that would not  be  safe.
  946.   Every  session  must  begin  with  a HELO, which gives the name of the
  947.   system that initiated the connection.  Then the sender and  recipients
  948.   are specified.  (There can be more than one RCPT command, if there are
  949.   several recipients.)  Finally the data itself is sent.  Note that  the
  950.   text  of the message is terminated by a line containing just a period.
  951.   (If such a line appears in the message, the period is doubled.)  After
  952.   the  message  is  accepted,  the  sender  can send another message, or
  953.   terminate the session as in the example above.
  954.  
  955.   Generally, there is a pattern to the response numbers.   The  protocol
  956.   defines  the  specific set of responses that can be sent as answers to
  957.   any given command.  However programs that don't want to  analyze  them
  958.   in  detail  can  just  look at the first digit.  In general, responses
  959.   that begin with a 2  indicate  success.    Those  that  begin  with  3
  960.   indicate  that some further action is needed, as shown above.  4 and 5
  961.   indicate errors.  4 is a "temporary" error, such as  a  disk  filling.
  962.   The  message should be saved, and tried again later.  5 is a permanent
  963.   error, such as a  non-existent  recipient.    The  message  should  be
  964.   returned to the sender with an error message.
  965.  
  966.   (For  more  details about the protocols mentioned in this section, see
  967.   RFC's 821/822 for mail, RFC 959 for file transfer, and  RFC's  854/855
  968.   for  remote  logins.  For the well-known port numbers, see the current
  969.   edition of Assigned Numbers, and possibly RFC 814.)
  970.  
  971.   4. Protocols other than TCP: UDP and ICMP
  972.  
  973.   So far, we have described only connections that use TCP.  Recall  that
  974.   TCP  is  responsible  for  breaking  up  messages  into datagrams, and
  975.   reassembling them properly.  However in  many  applications,  we  have
  976.   messages  that  will  always  fit in a single datagram.  An example is
  977.   name lookup.  When a user attempts to make  a  connection  to  another
  978.   system,  he  will  generally  specify  the system by name, rather than
  979.   Internet address.  His system has to translate that name to an address
  980.   before  it  can  do  anything.  Generally, only a few systems have the
  981.   database used to translate names to addresses.  So the  user's  system
  982.   will want to send a query to one of the systems that has the database.
  983.   This query is going to be very short.  It will certainly  fit  in  one
  984.   datagram.    So  will the answer.  Thus it seems silly to use TCP.  Of
  985.   course TCP does more than just break things up  into  datagrams.    It
  986.   also  makes  sure  that  the  data  arrives, resending datagrams where
  987.   necessary.  But for a question that fits  in  a  single  datagram,  we
  988.   don't  need  all the complexity of TCP to do this.  If we don't get an
  989.   answer after a few seconds, we can just ask again.   For  applications
  990.   like this, there are alternatives to TCP.
  991.  
  992.   The most common alternative is UDP ("user datagram protocol").  UDP is
  993.   designed for applications where you don't need  to  put  sequences  of
  994.   datagrams  together.  It fits into the system much like TCP.  There is
  995.                                     17
  996.  
  997.   a UDP header.  The network software puts the UDP header on  the  front
  998.   of  your  data, just as it would put a TCP header on the front of your
  999.   data.  Then UDP sends the data  to  IP,  which  adds  the  IP  header,
  1000.   putting  UDP's  protocol number in the protocol field instead of TCP's
  1001.   protocol number.  However UDP doesn't do as much  as  TCP  does.    It
  1002.   doesn't  split data into multiple datagrams.  It doesn't keep track of
  1003.   what it has sent so it can resend if necessary.  About  all  that  UDP
  1004.   provides  is  port  numbers,  so  that several programs can use UDP at
  1005.   once.  UDP port numbers are used just like TCP port  numbers.    There
  1006.   are  well-known  port numbers for servers that use UDP.  Note that the
  1007.   UDP header is shorter than a TCP header.   It  still  has  source  and
  1008.   destination  port  numbers,  and  a checksum, but that's about it.  No
  1009.   sequence number, since it is not needed.  UDP is used by the protocols
  1010.   that  handle  name  lookups (see IEN 116, RFC 882, and RFC 883), and a
  1011.   number of similar protocols.
  1012.  
  1013.   Another  alternative  protocol  is  ICMP  ("Internet  control  message
  1014.   protocol").    ICMP  is  used  for  error messages, and other messages
  1015.   intended for the TCP/IP software itself, rather  than  any  particular
  1016.   user  program.  For example, if you attempt to connect to a host, your
  1017.   system may get back an ICMP message saying "host unreachable".    ICMP
  1018.   can  also be used to find out some information about the network.  See
  1019.   RFC 792 for details of ICMP.  ICMP is  similar  to  UDP,  in  that  it
  1020.   handles messages that fit in one datagram.  However it is even simpler
  1021.   than UDP.  It doesn't even have port numbers in its header.  Since all
  1022.   ICMP  messages are interpreted by the network software itself, no port
  1023.   numbers are needed to say where a ICMP message is supposed to go.
  1024.  
  1025.   5. Keeping track of names and information: the domain system
  1026.  
  1027.   As we indicated earlier, the network software generally needs a 32-bit
  1028.   Internet  address  in  order  to open a connection or send a datagram.
  1029.   However users prefer to deal with computer names rather than  numbers.
  1030.   Thus  there  is  a database that allows the software to look up a name
  1031.   and find the corresponding number.  When the Internet was small,  this
  1032.   was  easy.  Each system would have a file that listed all of the other
  1033.   systems, giving both their name and number.  There are  now  too  many
  1034.   computers  for  this  approach to be practical.  Thus these files have
  1035.   been replaced by a set of name servers that keep track of  host  names
  1036.   and  the corresponding Internet addresses.  (In fact these servers are
  1037.   somewhat more general than that.  This is just one kind of information
  1038.   stored in the domain system.)  Note that a set of interlocking servers
  1039.   are used, rather than a single central one.  There  are  now  so  many
  1040.   different  institutions  connected  to  the  Internet that it would be
  1041.   impractical for them to  notify  a  central  authority  whenever  they
  1042.   installed  or moved a computer.  Thus naming authority is delegated to
  1043.   individual institutions.  The name servers form a tree,  corresponding
  1044.   to  institutional  structure.    The names themselves follow a similar
  1045.   structure.  A typical example is the name BORAX.LCS.MIT.EDU.  This  is
  1046.   a  computer  at  the Laboratory for Computer Science (LCS) at MIT.  In
  1047.   order to find its Internet address,  you  might  potentially  have  to
  1048.   consult  4  different  servers.  First, you would ask a central server
  1049.                                     18
  1050.  
  1051.   (called the root) where the EDU server is.  EDU is a server that keeps
  1052.   track of educational institutions.  The root server would give you the
  1053.   names and Internet addresses of several servers for EDU.   (There  are
  1054.   several  servers  at  each  level,  to allow for the possibly that one
  1055.   might be down.)  You would then ask EDU where the server for  MIT  is.
  1056.   Again,  it  would  give  you  names  and Internet addresses of several
  1057.   servers for MIT.  Generally, not all of those servers would be at MIT,
  1058.   to  allow for the possibility of a general power failure at MIT.  Then
  1059.   you would ask MIT where the server for LCS is, and finally  you  would
  1060.   ask one of the LCS servers about BORAX.  The final result would be the
  1061.   Internet address for BORAX.LCS.MIT.EDU.    Each  of  these  levels  is
  1062.   referred  to  as  a  "domain".  The entire name, BORAX.LCS.MIT.EDU, is
  1063.   called a "domain name".    (So  are  the  names  of  the  higher-level
  1064.   domains, such as LCS.MIT.EDU, MIT.EDU, and EDU.)
  1065.  
  1066.   Fortunately,  you  don't really have to go through all of this most of
  1067.   the time.  First of all, the root name servers also happen to  be  the
  1068.   name  servers  for  the  top-level domains such as EDU.  Thus a single
  1069.   query to a root  server  will  get  you  to  MIT.    Second,  software
  1070.   generally  remembers answers that it got before.  So once we look up a
  1071.   name at LCS.MIT.EDU, our software remembers where to find servers  for
  1072.   LCS.MIT.EDU,  MIT.EDU,  and EDU.  It also remembers the translation of
  1073.   BORAX.LCS.MIT.EDU.  Each of these pieces of information has a "time to
  1074.   live"  associated with it.  Typically this is a few days.  After that,
  1075.   the information expires and has to be looked up again.    This  allows
  1076.   institutions to change things.
  1077.  
  1078.   The  domain  system  is not limited to finding out Internet addresses.
  1079.   Each domain name is a node in a database.  The node can  have  records
  1080.   that  define  a number of different properties.  Examples are Internet
  1081.   address, computer type, and a list of services provided by a computer.
  1082.   A  program  can  ask  for  a  specific  piece  of  information, or all
  1083.   information about a given name.  It is possible  for  a  node  in  the
  1084.   database  to  be  marked as an "alias" (or nickname) for another node.
  1085.   It is also possible to use the  domain  system  to  store  information
  1086.   about users, mailing lists, or other objects.
  1087.  
  1088.   There  is  an  Internet  standard  defining  the  operation  of  these
  1089.   databases, as well as the protocols used  to  make  queries  of  them.
  1090.   Every  network utility has to be able to make such queries, since this
  1091.   is now the official way to evaluate host names.   Generally  utilities
  1092.   will talk to a server on their own system.  This server will take care
  1093.   of contacting the other servers for them.  This keeps down the  amount
  1094.   of code that has to be in each application program.
  1095.  
  1096.   The  domain  system  is  particularly  important for handling computer
  1097.   mail.  There are entry types to define what computer handles mail  for
  1098.   a  given  name, to specify where an individual is to receive mail, and
  1099.   to define mailing lists.
  1100.  
  1101.   (See RFC's 882, 883, and 973 for specifications of the domain  system.
  1102.   RFC 974 defines the use of the domain system in sending mail.)
  1103.  
  1104.                                     19
  1105.  
  1106.   6. Routing
  1107.  
  1108.   The   description  above  indicated  that  the  IP  implementation  is
  1109.   responsible for getting datagrams to the destination indicated by  the
  1110.   destination address, but little was said about how this would be done.
  1111.   The task of finding how to  get  a  datagram  to  its  destination  is
  1112.   referred to as "routing".  In fact many of the details depend upon the
  1113.   particular implementation.  However some general things can be said.
  1114.  
  1115.   First, it is necessary to understand the model on which IP  is  based.
  1116.   IP assumes that a system is attached to some local network.  We assume
  1117.   that the system can send datagrams to any  other  system  on  its  own
  1118.   network.    (In  the  case  of  Ethernet, it simply finds the Ethernet
  1119.   address of the destination system, and puts the datagram  out  on  the
  1120.   Ethernet.)    The  problem  comes  when  a  system  is asked to send a
  1121.   datagram to a system on a different network.  This problem is  handled
  1122.   by  gateways.   A gateway is a system that connects a network with one
  1123.   or more other networks.  Gateways  are  often  normal  computers  that
  1124.   happen  to have more than one network interface.  For example, we have
  1125.   a Unix machine that has two different Ethernet interfaces.  Thus it is
  1126.   connected  to networks 128.6.4 and 128.6.3.  This machine can act as a
  1127.   gateway between those two networks.  The software on that machine must
  1128.   be  set  up  so that it will forward datagrams from one network to the
  1129.   other.  That is, if a machine on network 128.6.4 sends a  datagram  to
  1130.   the  gateway,  and  the  datagram is addressed to a machine on network
  1131.   128.6.3, the gateway will forward the  datagram  to  the  destination.
  1132.   Major communications centers often have gateways that connect a number
  1133.   of different  networks.    (In  many  cases,  special-purpose  gateway
  1134.   systems provide better performance or reliability than general-purpose
  1135.   systems acting as gateways.  A number of vendors sell such systems.)
  1136.  
  1137.   Routing in IP is  based  entirely  upon  the  network  number  of  the
  1138.   destination  address.    Each computer has a table of network numbers.
  1139.   For each network number, a gateway is listed.  This is the gateway  to
  1140.   be used to get to that network.  Note that the gateway doesn't have to
  1141.   connect directly to the network.  It just has to be the best place  to
  1142.   go  to  get there.  For example at Rutgers, our interface to NSFnet is
  1143.   at the John von Neuman Supercomputer Center (JvNC). Our connection  to
  1144.   JvNC  is  via  a  high-speed  serial line connected to a gateway whose
  1145.   address is 128.6.3.12.  Systems on net 128.6.3 will list 128.6.3.12 as
  1146.   the  gateway  for  many  off-campus  networks.  However systems on net
  1147.   128.6.4 will list 128.6.4.1 as the gateway to  those  same  off-campus
  1148.   networks.    128.6.4.1  is  the  gateway  between networks 128.6.4 and
  1149.   128.6.3, so it is the first step in getting to JvNC.
  1150.  
  1151.   When a computer wants to send a datagram, it first checks  to  see  if
  1152.   the  destination address is on the system's own local network.  If so,
  1153.   the datagram can be sent directly.  Otherwise, the system  expects  to
  1154.   find an entry for the network that the destination address is on.  The
  1155.   datagram is sent to the gateway listed in that entry.  This table  can
  1156.   get quite big.  For example, the Internet now includes several hundred
  1157.   individual networks.  Thus various strategies have been  developed  to
  1158.   reduce  the size of the routing table.  One strategy is to depend upon
  1159.   "default routes".  Often, there is only one gateway out of a  network.
  1160.                                     20
  1161.  
  1162.   This  gateway might connect a local Ethernet to a campus-wide backbone
  1163.   network.  In that case, we don't need to have  a  separate  entry  for
  1164.   every  network  in  the  world.    We  simply define that gateway as a
  1165.   "default".  When no specific  route  is  found  for  a  datagram,  the
  1166.   datagram  is  sent to the default gateway.  A default gateway can even
  1167.   be used when there are several gateways  on  a  network.    There  are
  1168.   provisions  for  gateways  to  send a message saying "I'm not the best
  1169.   gateway -- use this one instead."  (The message is sent via ICMP.  See
  1170.   RFC  792.)  Most network software is designed to use these messages to
  1171.   add entries to their routing tables.  Suppose network 128.6.4 has  two
  1172.   gateways, 128.6.4.59 and 128.6.4.1.  128.6.4.59 leads to several other
  1173.   internal Rutgers networks.  128.6.4.1 leads indirectly to the  NSFnet.
  1174.   Suppose  we  set  128.6.4.59  as  a default gateway, and have no other
  1175.   routing table entries.  Now what  happens  when  we  need  to  send  a
  1176.   datagram  to  MIT?    MIT  is  network 18.  Since we have no entry for
  1177.   network 18, the datagram will be sent to the default, 128.6.4.59.   As
  1178.   it  happens,  this  gateway  is the wrong one.  So it will forward the
  1179.   datagram to 128.6.4.1.  But it will also send back an error saying  in
  1180.   effect: "to get to network 18, use 128.6.4.1".  Our software will then
  1181.   add an entry to the routing table.  Any future datagrams to  MIT  will
  1182.   then  go  directly to 128.6.4.1.  (The error message is sent using the
  1183.   ICMP protocol.  The message type is called "ICMP redirect.")
  1184.  
  1185.   Most IP experts recommend that individual computers should not try  to
  1186.   keep  track  of  the  entire network.  Instead, they should start with
  1187.   default gateways, and let the gateways tell them the routes,  as  just
  1188.   described.   However this doesn't say how the gateways should find out
  1189.   about the routes.  The gateways can't depend upon this strategy.  They
  1190.   have  to  have fairly complete routing tables.  For this, some sort of
  1191.   routing protocol is needed.  A routing protocol is simply a  technique
  1192.   for  the  gateways  to  find each other, and keep up to date about the
  1193.   best way to get to every network.   RFC  1009  contains  a  review  of
  1194.   gateway  design  and  routing.    However rip.doc is probably a better
  1195.   introduction to the subject.  It contains some tutorial material,  and
  1196.   a detailed description of the most commonly-used routing protocol.
  1197.  
  1198.   7. Details about Internet addresses: subnets and broadcasting
  1199.  
  1200.   As  indicated earlier, Internet addresses are 32-bit numbers, normally
  1201.   written as 4 octets (in decimal), e.g. 128.6.4.7.  There are  actually
  1202.   3  different types of address.  The problem is that the address has to
  1203.   indicate both the network and the host within the  network.    It  was
  1204.   felt  that  eventually  there would be lots of networks.  Many of them
  1205.   would be small, but probably 24 bits would be needed to represent  all
  1206.   the  IP  networks.  It was also felt that some very big networks might
  1207.   need 24 bits to represent all of their hosts.  This would seem to lead
  1208.   to  48  bit  addresses.  But the designers really wanted to use 32 bit
  1209.   addresses.  So they adopted a kludge.  The assumption is that most  of
  1210.   the  networks will be small.  So they set up three different ranges of
  1211.   address.  Addresses beginning with 1 to 126 use only the  first  octet
  1212.   for  the network number.  The other three octets are available for the
  1213.   host number.  Thus 24 bits are available for hosts.  These numbers are
  1214.                                     21
  1215.  
  1216.   used  for large networks.  But there can only be 126 of these very big
  1217.   networks.  The Arpanet is one, and there are a  few  large  commercial
  1218.   networks.    But  few  normal organizations get one of these "class A"
  1219.   addresses.  For normal large organizations, "class  B"  addresses  are
  1220.   used.    Class  B  addresses  use the first two octets for the network
  1221.   number.  Thus network numbers are 128.1 through 191.254.  (We avoid  0
  1222.   and  255,  for  reasons  that  we  see below.  We also avoid addresses
  1223.   beginning with 127, because that is used by some systems  for  special
  1224.   purposes.)    The  last  two  octets  are available for host addesses,
  1225.   giving 16 bits of host address.   This  allows  for  64516  computers,
  1226.   which should be enough for most organizations.  (It is possible to get
  1227.   more than one class B address, if you run  out.)    Finally,  class  C
  1228.   addresses  use  three  octets,  in  the  range 192.1.1 to 223.254.254.
  1229.   These allow only 254 hosts on each network, but there can be  lots  of
  1230.   these  networks.   Addresses above 223 are reserved for future use, as
  1231.   class D and E (which are currently not defined).
  1232.  
  1233.   Many large organizations find it convenient to  divide  their  network
  1234.   number into "subnets".  For example, Rutgers has been assigned a class
  1235.   B address, 128.6.  We find it convenient to use the third octet of the
  1236.   address to indicate which Ethernet a host is on.  This division has no
  1237.   significance outside of Rutgers.  A computer  at  another  institution
  1238.   would treat all datagrams addressed to 128.6 the same way.  They would
  1239.   not look at the third octet of the address.   Thus  computers  outside
  1240.   Rutgers  would  not have different routes for 128.6.4 or 128.6.5.  But
  1241.   inside Rutgers, we treat 128.6.4 and 128.6.5 as separate networks.  In
  1242.   effect, gateways inside Rutgers have separate entries for each Rutgers
  1243.   subnet, whereas gateways outside  Rutgers  just  have  one  entry  for
  1244.   128.6.  Note  that  we  could  do  exactly  the  same thing by using a
  1245.   separate class C address for each Ethernet.   As  far  as  Rutgers  is
  1246.   concerned,  it  would be just as convenient for us to have a number of
  1247.   class C addresses.  However using class C addresses would make  things
  1248.   inconvenient for the rest of the world.  Every institution that wanted
  1249.   to talk to us would have to have a separate entry for each one of  our
  1250.   networks.   If every institution did this, there would be far too many
  1251.   networks for any reasonable gateway to keep track of.  By  subdividing
  1252.   a  class B network, we hide our internal structure from everyone else,
  1253.   and  save  them  trouble.    This  subnet  strategy  requires  special
  1254.   provisions in the network software.  It is described in RFC 950.
  1255.  
  1256.   0  and  255  have  special  meanings.  0 is reserved for machines that
  1257.   don't know their address.  In certain circumstances it is possible for
  1258.   a  machine not to know the number of the network it is on, or even its
  1259.   own host address.  For example, 0.0.0.23 would be a machine that  knew
  1260.   it was host number 23, but didn't know on what network.
  1261.  
  1262.   255  is  used for "broadcast".  A broadcast is a message that you want
  1263.   every system on the network to see.    Broadcasts  are  used  in  some
  1264.   situations  where you don't know who to talk to.  For example, suppose
  1265.   you need to look  up  a  host  name  and  get  its  Internet  address.
  1266.   Sometimes  you  don't know the address of the nearest name server.  In
  1267.   that case, you might send the request as a broadcast.  There are  also
  1268.   cases  where a number of systems are interested in information.  It is
  1269.   then less expensive to send a single broadcast than to send  datagrams
  1270.   individually  to  each host that is interested in the information.  In
  1271.                                     22
  1272.  
  1273.   order to send a broadcast, you use an address that is  made  by  using
  1274.   your  network  address, with all ones in the part of the address where
  1275.   the host number goes.  For example, if you are on network 128.6.4, you
  1276.   would   use   128.6.4.255  for  broadcasts.    How  this  is  actually
  1277.   implemented depends upon the medium.   It  is  not  possible  to  send
  1278.   broadcasts  on the Arpanet, or on point to point lines.  However it is
  1279.   possible on an Ethernet.  If you use an Ethernet address with all  its
  1280.   bits  on (all ones), every machine on the Ethernet is supposed to look
  1281.   at that datagram.
  1282.  
  1283.   Although the official broadcast address for  network  128.6.4  is  now
  1284.   128.6.4.255,  there  are  some  other addresses that may be treated as
  1285.   broadcasts by certain implementations.  For convenience, the  standard
  1286.   also  allows  255.255.255.255 to be used.  This refers to all hosts on
  1287.   the local network.  It is often simpler to use 255.255.255.255 instead
  1288.   of  finding out the network number for the local network and forming a
  1289.   broadcast address such as 128.6.4.255.   In  addition,  certain  older
  1290.   implementations  may  use  0  instead  of  255  to  form the broadcast
  1291.   address.    Such  implementations  would  use  128.6.4.0  instead   of
  1292.   128.6.4.255  as  the  broadcast  address on network 128.6.4.  Finally,
  1293.   certain older implementations may not understand about subnets.   Thus
  1294.   they consider the network number to be 128.6.  In that case, they will
  1295.   assume a broadcast address  of  128.6.255.255  or  128.6.0.0.    Until
  1296.   support  for  broadcasts is implemented properly, it can be a somewhat
  1297.   dangerous feature to use.
  1298.  
  1299.   Because 0 and 255 are used for unknown and broadcast addresses, normal
  1300.   hosts  should never be given addresses containing 0 or 255.  Addresses
  1301.   should never begin with 0, 127, or any number above  223.    Addresses
  1302.   violating these rules are sometimes referred to as "Martians", because
  1303.   of rumors that the Central University of Mars is using network 225.
  1304.  
  1305.   8. Datagram fragmentation and reassembly
  1306.  
  1307.   TCP/IP is designed for use  with  many  different  kinds  of  network.
  1308.   Unfortunately,  network  designers  do not agree about how big packets
  1309.   can be.  Ethernet packets can be 1500 octets long.    Arpanet  packets
  1310.   have  a  maximum  of around 1000 octets.  Some very fast networks have
  1311.   much larger packet sizes.  At first, you might think  that  IP  should
  1312.   simply  settle  on  the  smallest  possible size.  Unfortunately, this
  1313.   would cause serious performance problems.    When  transferring  large
  1314.   files, big packets are far more efficient than small ones.  So we want
  1315.   to be able to use the largest packet size possible.  But we also  want
  1316.   to  be  able  to  handle  networks  with  small limits.  There are two
  1317.   provisions for this.  First, TCP has the ability to "negotiate"  about
  1318.   datagram  size.  When a TCP connection first opens, both ends can send
  1319.   the maximum datagram size they can  handle.    The  smaller  of  these
  1320.   numbers  is  used  for  the  rest  of the connection.  This allows two
  1321.   implementations that can handle big datagrams to use  them,  but  also
  1322.   lets  them  talk  to  implementations that can't handle them.  However
  1323.   this doesn't completely solve the problem.  The most  serious  problem
  1324.   is  that the two ends don't necessarily know about all of the steps in
  1325.                                     23
  1326.  
  1327.   between.  For example, when sending data between Rutgers and Berkeley,
  1328.   it is likely that both computers will be on Ethernets.  Thus they will
  1329.   both  be  prepared  to  handle  1500-octet  datagrams.    However  the
  1330.   connection will at some point end up going over the Arpanet.  It can't
  1331.   handle packets of that size.  For this reason, there are provisions to
  1332.   split   datagrams   up   into   pieces.    (This  is  referred  to  as
  1333.   "fragmentation".)  The IP header  contains  fields  indicating  the  a
  1334.   datagram  has  been split, and enough information to let the pieces be
  1335.   put back together.  If a gateway connects an Ethernet to the  Arpanet,
  1336.   it must be prepared to take 1500-octet Ethernet packets and split them
  1337.   into pieces that will fit on the Arpanet.    Furthermore,  every  host
  1338.   implementation  of  TCP/IP  must  be prepared to accept pieces and put
  1339.   them back together.  This is referred to as "reassembly".
  1340.  
  1341.   TCP/IP implementations differ in the approach they take to deciding on
  1342.   datagram  size.    It  is  fairly  common  for  implementations to use
  1343.   576-byte datagrams whenever they can't verify that the entire path  is
  1344.   able  to  handle larger packets.  This rather conservative strategy is
  1345.   used because of the number of implementations with bugs in the code to
  1346.   reassemble  fragments.    Implementors  often try to avoid ever having
  1347.   fragmentation occur.  Different implementors take different approaches
  1348.   to  deciding  when  it  is safe to use large datagrams.  Some use them
  1349.   only for the local network.  Others will use them for any  network  on
  1350.   the   same   campus.    576  bytes  is  a  "safe"  size,  which  every
  1351.   implementation must support.
  1352.  
  1353.   9. Ethernet encapsulation: ARP
  1354.  
  1355.   There was a brief discussion earlier about what IP datagrams look like
  1356.   on  an  Ethernet.    The  discussion  showed  the  Ethernet header and
  1357.   checksum.  However it left one hole: It didn't say how to  figure  out
  1358.   what Ethernet address to use when you want to talk to a given Internet
  1359.   address.  In fact, there is a separate protocol for this,  called  ARP
  1360.   ("address  resolution protocol").  (Note by the way that ARP is not an
  1361.   IP protocol.  That is, the ARP datagrams  do  not  have  IP  headers.)
  1362.   Suppose  you  are  on  system  128.6.4.194  and you want to connect to
  1363.   system 128.6.4.7.  Your system will first verify that 128.6.4.7 is  on
  1364.   the  same network, so it can talk directly via Ethernet.  Then it will
  1365.   look up 128.6.4.7 in its ARP table, to see if  it  already  knows  the
  1366.   Ethernet  address.    If  so, it will stick on an Ethernet header, and
  1367.   send the packet.  But suppose this system is not  in  the  ARP  table.
  1368.   There  is  no  way  to  send the packet, because you need the Ethernet
  1369.   address.  So it  uses  the  ARP  protocol  to  send  an  ARP  request.
  1370.   Essentially  an  ARP  request  says  "I  need the Ethernet address for
  1371.   128.6.4.7".  Every system listens to ARP requests.  When a system sees
  1372.   an  ARP  request  for itself, it is required to respond.  So 128.6.4.7
  1373.   will see the request, and will respond with an  ARP  reply  saying  in
  1374.   effect "128.6.4.7 is 8:0:20:1:56:34".  (Recall that Ethernet addresses
  1375.   are 48 bits.  This is 6 octets.  Ethernet addresses are conventionally
  1376.   shown  in  hex,  using  the punctuation shown.)  Your system will save
  1377.   this information in its ARP table, so future packets will go directly.
  1378.   Most  systems  treat the ARP table as a cache, and clear entries in it
  1379.                                     24
  1380.  
  1381.   if they have not been used in a certain period of time.
  1382.  
  1383.   Note by the way that ARP requests must be sent as "broadcasts".  There
  1384.   is  no  way  that  an  ARP  request  can be sent directly to the right
  1385.   system.  After all, the whole reason for sending  an  ARP  request  is
  1386.   that  you  don't know the Ethernet address.  So an Ethernet address of
  1387.   all ones is  used,  i.e.  ff:ff:ff:ff:ff:ff.    By  convention,  every
  1388.   machine  on  the Ethernet is required to pay attention to packets with
  1389.   this as an address.  So every system sees every ARP  requests.    They
  1390.   all  look to see whether the request is for their own address.  If so,
  1391.   they respond.  If not, they could just ignore it.   (Some  hosts  will
  1392.   use  ARP  requests  to update their knowledge about other hosts on the
  1393.   network, even if the request isn't for them.)  Note that packets whose
  1394.   IP  address  indicates broadcast (e.g. 255.255.255.255 or 128.6.4.255)
  1395.   are also sent with an Ethernet address that is all ones.
  1396.  
  1397.   10. Getting more information
  1398.  
  1399.   This directory contains  documents  describing  the  major  protocols.
  1400.   There  are literally hundreds of documents, so we have chosen the ones
  1401.   that seem most important.  Internet standards are called RFC's.    RFC
  1402.   stands  for  Request  for  Comment.   A proposed standard is initially
  1403.   issued as a proposal, and given an RFC number.   When  it  is  finally
  1404.   accepted,  it is added to Official Internet Protocols, but it is still
  1405.   referred to by the RFC number.   We  have  also  included  two  IEN's.
  1406.   (IEN's  used  to  be  a  separate  classification  for  more  informal
  1407.   documents.  This classification no longer exists -- RFC's are now used
  1408.   for  all  official  Internet documents, and a mailing list is used for
  1409.   more informal reports.)  The convention is that  whenever  an  RFC  is
  1410.   revised, the revised version gets a new number.  This is fine for most
  1411.   purposes, but it causes problems with two documents: Assigned  Numbers
  1412.   and  Official  Internet  Protocols.  These documents are being revised
  1413.   all the time, so the RFC number keeps changing.  You will have to look
  1414.   in rfc-index.txt to find the number of the latest edition.  Anyone who
  1415.   is seriously interested in TCP/IP should read the  RFC  describing  IP
  1416.   (791).    RFC 1009 is also useful.  It is a specification for gateways
  1417.   to be used by NSFnet.  As such, it contains an overview of  a  lot  of
  1418.   the  TCP/IP technology.  You should probably also read the description
  1419.   of at least one of the application protocols, just to get a  feel  for
  1420.   the  way  things  work.    Mail is probably a good one (821/822).  TCP
  1421.   (793) is of course a very basic specification.  However  the  spec  is
  1422.   fairly  complex,  so  you should only read this when you have the time
  1423.   and patience to think about it carefully.  Fortunately, the author  of
  1424.   the  major  RFC's  (Jon Postel) is a very good writer.  The TCP RFC is
  1425.   far easier to read than you would expect, given the complexity of what
  1426.   it  is  describing.    You  can  look at the other RFC's as you become
  1427.   curious about their subject matter.
  1428.  
  1429.   Here is a list of the documents you are more likely to want:
  1430.  
  1431.        rfc-index list of all RFC's
  1432.  
  1433.                                     25
  1434.  
  1435.        rfc1012   somewhat fuller list of all RFC's
  1436.  
  1437.        rfc1011   Official Protocols.  It's useful to scan  this  to  see
  1438.                  what tasks protocols have been built for.  This defines
  1439.                  which  RFC's  are  actual  standards,  as  opposed   to
  1440.                  requests for comments.
  1441.  
  1442.        rfc1010   Assigned  Numbers.  If you are working with TCP/IP, you
  1443.                  will probably want a hardcopy of this as  a  reference.
  1444.                  It's  not  very  exciting  to  read.   It lists all the
  1445.                  offically defined well-known ports and  lots  of  other
  1446.                  things.
  1447.  
  1448.        rfc1009   NSFnet  gateway  specifications.  A good overview of IP
  1449.                  routing and gateway technology.
  1450.  
  1451.        rfc1001/2 netBIOS: networking for PC's
  1452.  
  1453.        rfc973    update on domains
  1454.  
  1455.        rfc959    FTP (file transfer)
  1456.  
  1457.        rfc950    subnets
  1458.  
  1459.        rfc937    POP2: protocol for reading mail on PC's
  1460.  
  1461.        rfc894    how IP is to be put on Ethernet, see also rfc825
  1462.  
  1463.        rfc882/3  domains (the database used to go  from  host  names  to
  1464.                  Internet  address  and back -- also used to handle UUCP
  1465.                  these days).  See also rfc973
  1466.  
  1467.        rfc854/5  telnet - protocol for remote logins
  1468.  
  1469.        rfc826    ARP - protocol for finding out Ethernet addresses
  1470.  
  1471.        rfc821/2  mail
  1472.  
  1473.        rfc814    names and ports - general  concepts  behind  well-known
  1474.                  ports
  1475.  
  1476.        rfc793    TCP
  1477.  
  1478.        rfc792    ICMP
  1479.  
  1480.        rfc791    IP
  1481.  
  1482.        rfc768    UDP
  1483.  
  1484.        rip.doc   details of the most commonly-used routing protocol
  1485.  
  1486.        ien-116   old  name  server  (still  needed  by  several kinds of
  1487.                  system)
  1488.  
  1489.        ien-48    the  Catenet  model,   general   description   of   the
  1490.                                     26
  1491.  
  1492.                  philosophy behind TCP/IP
  1493.  
  1494.   The following documents are somewhat more specialized.
  1495.  
  1496.        rfc813    window and acknowledgement strategies in TCP
  1497.  
  1498.        rfc815    datagram reassembly techniques
  1499.  
  1500.        rfc816    fault isolation and resolution techniques
  1501.  
  1502.        rfc817    modularity and efficiency in implementation
  1503.  
  1504.        rfc879    the maximum segment size option in TCP
  1505.  
  1506.        rfc896    congestion control
  1507.  
  1508.        rfc827,888,904,975,985
  1509.                  EGP and related issues
  1510.  
  1511.   To those of you who may be reading this document remotely  instead  of
  1512.   at  Rutgers:  The  most  important  RFC's  have  been collected into a
  1513.   three-volume set, the DDN Protocol Handbook.  It is available from the
  1514.   DDN  Network  Information  Center,  SRI  International, 333 Ravenswood
  1515.   Avenue, Menlo Park, California 94025 (telephone: 800-235-3155).    You
  1516.   should  be able to get them via anonymous FTP from sri-nic.arpa.  File
  1517.   names are:
  1518.  
  1519.     RFC's:
  1520.       rfc:rfc-index.txt
  1521.       rfc:rfcxxx.txt
  1522.     IEN's:
  1523.       ien:ien-index.txt
  1524.       ien:ien-xxx.txt
  1525.  
  1526.   rip.doc is available  by  anonymous  FTP  from  topaz.rutgers.edu,  as
  1527.   /pub/tcp-ip-docs/rip.doc.
  1528.  
  1529.   Sites with access to UUCP but not FTP may be able to retreive them via
  1530.   UUCP from UUCP host rutgers.  The file names would be
  1531.  
  1532.     RFC's:
  1533.       /topaz/pub/pub/tcp-ip-docs/rfc-index.txt
  1534.       /topaz/pub/pub/tcp-ip-docs/rfcxxx.txt
  1535.     IEN's:
  1536.       /topaz/pub/pub/tcp-ip-docs/ien-index.txt
  1537.       /topaz/pub/pub/tcp-ip-docs/ien-xxx.txt
  1538.     /topaz/pub/pub/tcp-ip-docs/rip.doc
  1539.  
  1540.   Note that SRI-NIC has the entire set of RFC's and IEN's,  but  rutgers
  1541.   and topaz have only those specifically mentioned above.
  1542.  
  1543.                                     27
  1544.  
  1545. ---------- ---------- ---------- --------- ---------- ----------
  1546. 9